<template>
  <div class="page_top">
    <span>工单统计</span>
    <el-row :gutter="20" style="padding: 2px; overflow: hidden;flex-shrink: 0">
      <el-col :span="6">
        <div class="box" @click="toPage('/hospital-list/index')">
          <img src="@/assets/img/3.png" class="img" width="50" height="50" />
          <div class="right">
            <div class="num">{{ listInfo.personCompleteCount  }}</div>
            <div class="name">本月个人用户报装工单总数</div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="box" @click="toPage('/user-doctor/index')">
          <img src="@/assets/img/4.png" class="img" width="50" height="50" />
          <div class="right">
            <div class="num">{{ listInfo.projectCompleteCount  }}</div>
            <div class="name">本月建设项目报装工单总数</div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="box" @click="toPage('/project-list/index')">
          <img src="@/assets/img/2.png" class="img" width="50" height="50" />
          <div class="right">
            <div class="num">{{ listInfo.meterCompleteCount  }}</div>
            <div class="name">本月一户一表报装工单总数</div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="box" @click="toPage('/order-finished/index')">
          <img src="@/assets/img/1.png" class="img" width="50" height="50" />
          <div class="right">
            <div class="num">{{ listInfo.alterCompleteCount }}</div>
            <div class="name">本月变更工程报装工单总数</div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: {
    info: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      listInfo: {
        personCompleteCount: 0,
        projectCompleteCount: 0,
        meterCompleteCount: 0,
        alterCompleteCount: 0
      }
    };
  },
  methods: {
    toPage(path) {
      this.$router.push({ path });
    },
    // 获取工单统计信息
    async getTopStats() {
      const [err, res] = await this.$Api.Stats.month();

      if (!err && res) {
        this.listInfo = res;
      }
    }
  },
  mounted() {
    this.getTopStats()
  }
};
</script>

<style lang="scss" scoped>
.page_top {
  span {
    display: inline-block;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
  }
}

.box {
  box-shadow: 0 0px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  padding: 15px;
  cursor: pointer;
  .img {
    @include shrink;
    margin-right: 15px;
    width: 60px;
    height: 60px;
  }
  .right {
    @include grow;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .num {
      font-weight: bold;
      font-size: 36px;
      color: $--color-primary;
    }
    .name {
    }
  }
}
</style>
